package 多线程;

/**
 * @author : K k
 * @date : 18:32 2020/9/7
 * run是通过主线程来执行的，start是通过创建新线程来执行的
 */
public class RunAndStart implements Runnable{

    @Override
    public void run() {
        try {
            Thread.sleep(5000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println(Thread.currentThread().getName()+"运行了。。。");
        //System.out.println(Thread.currentThread().getName() );
    }

    public static void main(String[] args) {
        RunAndStart runAndStart = new RunAndStart();
        Thread thread= new Thread(runAndStart);
        thread.start();
        thread.run();
    }

}
